package com.sandbox.ws;

import java.util.concurrent.LinkedBlockingQueue;

import org.springframework.batch.core.Job;
import org.springframework.batch.core.JobParametersBuilder;
import org.springframework.batch.core.launch.JobLauncher;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.edb.finance.collateral.ws.checkin.v1.CheckInRequest;
import com.evry.finance.collateral.wsdomain.Database;

public class App 
{
    public static void main( String[] args ) throws Throwable
    {
    	ApplicationContext appContext = new ClassPathXmlApplicationContext("two-step-parallel-batch-job.xml");
    	LinkedBlockingQueue<CheckInRequest> quq = (LinkedBlockingQueue) appContext.getBean("memoryQueue");
    	for (int i = 0; i < 5000; i++) {
			quq.add(new CheckInRequest());
		}
		JobLauncher jobLauncher = (JobLauncher) appContext.getBean("jobLauncher");
		Job job = (Job) appContext.getBean("importCollaterals");
		jobLauncher.run(job, new JobParametersBuilder().toJobParameters());
		System.exit(0);
    }
}
